package route

import (
	"svvenus/vgame/handler"
	"svvenus/vgame/logic"
	"svvenus/vpub/worker"
	"svvenus/znet/zpb"
	"svvenus/znet/ztcp"
)

// TcpConnStart 连接新建
// @param conn
func TcpConnStart(conn *ztcp.TcpConnection) {

}

// TcpConnStop 连接断开
// @param conn
func TcpConnStop(conn *ztcp.TcpConnection) {
	player := logic.ConnGetPlayer(conn)
	if player != nil {
		logic.PlayerDisconnection(player)
	}
}

// TcpRegister 消息注册
func TcpRegister() {

	worker.TcpWorkerBind(zpb.EPid_CGGmAction, handler.CGGmAction)

	worker.TcpWorkerBindSpeedy(zpb.EPid_CLUserLogin, handler.CLUserLogin)

	worker.TcpWorkerBindSpeedy(zpb.EPid_CGPlayerLogin, handler.CGPlayerLogin)
	worker.TcpWorkerBindSpeedy(zpb.EPid_CGPlayerLogout, handler.CGPlayerLogout)
	worker.TcpWorkerBindSpeedy(zpb.EPid_CGPlayerCreate, handler.CGPlayerCreate)

	worker.TcpWorkerBind(zpb.EPid_CGPlayerChangeName, handler.CGPlayerChangeName)
	worker.TcpWorkerBind(zpb.EPid_CGPlayerChangeHead, handler.CGPlayerChangeHead)
	worker.TcpWorkerBind(zpb.EPid_CGPlayerChangeFlagInt, handler.CGPlayerChangeFlagInt)
	worker.TcpWorkerBind(zpb.EPid_CGPlayerChangeFlagIntDaily, handler.CGPlayerChangeFlagIntDaily)

	worker.TcpWorkerBind(zpb.EPid_CGPlayerInit, handler.CGPlayerInit)

	worker.TcpWorkerBind(zpb.EPid_CGMailListGet, handler.CGMailListGet)
	worker.TcpWorkerBind(zpb.EPid_CGMailRead, handler.CGMailRead)
	worker.TcpWorkerBind(zpb.EPid_CGMailGet, handler.CGMailGet)
	worker.TcpWorkerBind(zpb.EPid_CGMailDelete, handler.CGMailDelete)
	worker.TcpWorkerBind(zpb.EPid_CGMailGetAll, handler.CGMailGetAll)
	worker.TcpWorkerBind(zpb.EPid_CGMailDeleteAll, handler.CGMailDeleteAll)

	worker.TcpWorkerBind(zpb.EPid_CGItemInfoGet, handler.CGItemInfoGet)

	worker.TcpWorkerBind(zpb.EPid_CGEquipInfoGet, handler.CGEquipInfoGet)

}
